<template>
  <div class="loading-container">
    <div class="loading">
      <!-- 小球 -->
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
    <svg>
      <filter id="gooey">
        <feGaussianBlur in="SourceGraphic" stdDeviation="10"></feGaussianBlur>
        <feColorMatrix values="
            1 0 0 0 0
            0 1 0 0 0
            0 0 1 0 0
            0 0 0 20 -10
            " />
      </filter>
    </svg>
  </div>
</template>

<script>
  export default {
    name: "Loading"
  }
</script>

<style scoped>
  .loading-container {
    margin: 0;
    padding: 0;
    height: 100vh;
    position: fixed;
    top: 50%;
    left: 50%;
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }
  svg {
    width: 0;
    height: 0;
  }
  .loading {
    position: relative;
    width: 100px;
    height: 100px;
    filter: url(#gooey);
  }

  .loading span {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    display: block;
    animation: loading 2s ease-in-out infinite;
  }

  .loading span:nth-child(1) {
    animation-delay: 0.1s;
  }

  .loading span:nth-child(2) {
    animation-delay: 0.2s;
  }

  .loading span:nth-child(3) {
    animation-delay: 0.3s;
  }

  .loading span:nth-child(4) {
    animation-delay: 0.4s;
  }

  .loading span:nth-child(5) {
    animation-delay: 0.5s;
  }

  .loading span:nth-child(6) {
    animation-delay: 0.6s;
  }

  .loading span:nth-child(7) {
    animation-delay: 0.72s;
  }

  .loading span::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 0;
    left: calc(50% - 10px);
    box-shadow: 0 0 15px #03a9f4;
    /* 设置渐变颜色 */
    background: linear-gradient(#fce4ec, #03a9f4);
  }

  @keyframes loading {
    0% {
      transform: rotate(0deg);
    }

    50%,
    100% {
      transform: rotate(360deg);
    }
  }
</style>
